
<script type="text/javascript" src="<?php echo $url_template?>/js/holder.js"></script>
<h2>Boutique <a class="btn" href="<?php echo $CFG->config['base_url']?>shop/admin/new_shop">Ajouter</a></h2>

<div id="ajax-response"></div>

<form class="form-horizontal" method="post" action="" id="posts-filter">


<div class="navbar">
<div class="navbar-inner">
		<ul class="nav">
			<li><a class="current" href="<?php echo $CFG->config['base_url']?>shop/admin">Tous <span class="count">(<?php echo $total?>)</span></a></li>
			<li class="divider-vertical"></li>
			<li><a href="<?php echo $CFG->config['base_url']?>shop/admin/index/status/publish">Activé <span class="count">(<?php echo $totalActive?>)</span></a></li>
		</ul>
		<ul class=" navbar-form  pull-right">
        <div class="input-append">
            <input type="text"  name="s"/>
            <button type="submit" class="btn"><i class="icon-search"></i></button>
        </div>
        </ul>
</div>
</div>


<div class="navbar">
  <div class="navbar-form">
    <div class="container">
      <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>
      
      <div class="nav-collapse collapse">
        <ul class="nav">
          <li>
	          <select name="action">
					<option selected="selected" value="0">Actions Groupées</option>
					<option class="hide-if-no-js" value="edit">Modifier</option>
					<option value="trash">Déplacer dans la Corbeille</option>
				</select>
			</li>
            <li>
	            <select name="filter[date]">
					<option value="0" selected="selected">Toutes Dates</option>
					<?php 
					foreach($option_filter_date as $list){
						$s=$list->YearMonth==$filter['date']?' selected ' : '';
						echo "<option value='{$list->YearMonth}' $s>{$list->month} - {$list->year}</option>";
					}
					?>
				</select>
          </li>                    
          <li>
            <select class="postform" id="cat" name="filter[category]" onchange="if(this.value=!'')showOption(this.value)" >
				<option value="" >Categorie</option>
					<?php echo $option_filter_category?>
			</select>
			<input type="submit" value="Filtrer" class="btn" id="post-query-submit">
          
          </li>
        </ul>
        <ul class="nav pull-right">
        	<li><?php echo $totalActive?> annonces </li>
        	<li> &nbsp </li>
        	<li class="pagination pagination-small">
				<ul>
					<li><a href="#">Prev</a></li>
					<?php foreach (range(1, ceil($total/$limit)) as $numPage):?>
					<li <?php if(isset($paged) and $paged==$numPage)echo 'class="disabled "' ?>><a href="#"><?php echo $numPage?></a></li>
					<?php endforeach;?>
					
					 <li><a href="#">Next</a></li>
				</ul>
        	</li>
        </ul>  
      </div><!-- /.nav-collapse -->
    </div>
  </div><!-- /navbar-inner -->
</div>


			
<script type="text/javascript">
	function sort($nameCol,$this){
		$input=$this.next("input");
		$typeOfSort=$input.val();
		
		if($typeOfSort=='desc')$typeOfSort='asc';
		else $typeOfSort='desc';
		$input.attr('name','sort['+$nameCol+']');
		$input.val($typeOfSort);
		$('#posts-filter').submit();
	}
</script>

<table class="table">
	<thead>
	<tr>
		<th id="Tout">
		<input type="checkbox" id="cb-select-all-1" class="checkall"/>
		</th>
		<th>Logo</th>
		<th class="title sortable desc" id="Titre">
		<a href="#" onclick="sort('company_name')"><span>Société & Texte</span><span class="sorting-indicator"></span></a>
		<input type="hidden" value="<?php echo $sort['company_name']?>" name="sort[company_name]" />
		</th>
		<th class="shopcategories">Categories</th>
		<th class="shopinformation">Information</th>
		<th class="shopvalider">V</th>
        <th class="shopcreation">Date Créa</th>
        <th class="shopdepartement">CP</th>
        <th class="shopvue num sortable desc ">
			<a href="#" onclick="sort('shop_counter',$(this))">
				<span>Vues</span>
				<span class="sorting-indicator"></span>
			</a>
			<input type="hidden" value="<?php echo $sort['shop_counter']?>" name="sort[shop_counter]" />
		</th>
		<th class="annoncepropar" scope="col">Ann°</span><span class="sorting-indicator"></span></a></th>
        <th class="annoncemontant">total</span><span class="sorting-indicator"></span></a></th>
       </tr>
	</thead>

	<tfoot>
	<tr>
		<th class="cb check-column shoptout" id="Tout" >
		<input type="checkbox" id="cb-select-all-1" class="checkall"/>
		</th>
		<th>Logo</th>
		<th id="Titre">
		<a href="#" onclick="sort('company_name')"><span>Société & Texte</span><span class="sorting-indicator"></span></a>
		<input type="hidden" value="<?php echo $sort['company_name']?>" name="sort[company_name]" />
		</th>
		<th>Categories</th>
		<th>Information</th>
		<th>V</th>
        <th>Date Créa</th>
        <th>CP</th>
        <th>
			<a href="#" onclick="sort('shop_counter',$(this))">
				<span>Vues</span>
				<span class="sorting-indicator"></span>
			</a>
			<input type="hidden" value="<?php echo $sort['shop_counter']?>" name="sort[shop_counter]" />
		</th>
		<th>Ann°</span><span class="sorting-indicator"></span></a></th>
        <th>total</span><span class="sorting-indicator"></span></a></th>
       </tr>
	</tfoot>

	<tbody id="the-list">
	<?php 
	if(!empty($listAllProducts))
		foreach ($listAllProducts as $shop){

	?>
		<tr id="post-<?php echo $shop->id?>">
			<th>
				<input type="checkbox" value="<?php echo $shop->id?>" name="post[]" id="cb-select-<?php echo $shop->id?>">
			</th>
			<td class="thumbnails">
				 <a href="<?php echo $CFG->config['base_url']?>shop/admin/edit/<?php echo $shop->id?>" class="thumbnail">
				 	<img style="max-width:100px;max-height:100px " src="<?php echo $CFG->config['base_url']?>images/logos/thumbnails/<?php echo $shop->logo?>"/>
				 </a>
			</td>
			<td>
				<strong><a title="Modifier <?php echo $shop->company_name?>" href="<?php echo $CFG->config['base_url']?>shop/admin/edit/<?php echo $shop->id?>" class="row-title"><?php echo $shop->company_name?></a>
				</strong>
				<div class="lignes" id="lignes"><?php 
				$this->load->helper('text');
				echo word_limiter(strip_tags($shop->description),40);				
				?></div>
				<div class="row-actions">
					<span class="edit"><a title="Modifier Produit" href="<?php echo $CFG->config['base_url']?>shop/admin/edit/<?php echo $shop->id?>">Modifier</a> | </span>
					<?php 
					$active=$shop->shop_active?'deactive':'reactive';
					$activeShow=$shop->shop_active?'Déactiver':'reactiver';
					?>
					<span class="trash"><a href="<?php echo $CFG->config['base_url']?>shop/admin/<?php echo $active.'/'.$shop->id?>" title="placer dans le corbeille" class="submitdelete"><?php echo $activeShow?></a> | </span>
					<span class="view"><a rel="permalink" title="Voir <?php echo $shop->company_name?>" href="<?php echo $CFG->config['base_url'].'boutique/'.$shop->shop_link?>.html">Apperçu</a></span>
				</div>
			</td>
			<td><?php echo $shop->category_name?></td>
			<td><strong><?php echo $shop->frist_name?></strong> <strong><?php echo $shop->last_name?></strong><br />
			<a href="<?php echo $shop->site?>"><?php echo $shop->company_name?></a><br/>
			<strong><?php echo $shop->email?></strong><br/>			
				<?php echo $shop->siren?>
			</td>
		  <td>
		  		<?php echo $shop->shop_active?
					' <div class="valideroui"> </div>':
		  			' <div class="validernon"> </div>';?>
		  	</td>
			<td><strong><?php echo date('d/m/Y',$shop->date_create)?></strong></td>
			<td>
				 <div id="cp" title="<?php echo $shop->ville?>"><?php echo $shop->code_postal?> - <?php echo $shop->ville?></div>
			</td>
            <td><?php echo $shop->shop_counter?></td>
			<td><?php echo $shop->num_product?></td>
			<td><?php echo $shop->total?></td>
		</tr>
		<?php }?>
	</tbody>
</table>


</form>